//第24天

package main

import (
	"fmt"
	"strconv"
)

//map是无序的
func test1()  {
	mp := map[string]string {"0":"value1", "1":"vaule2", "2":"vaule3", "3":"vaule4"}
	for k, v := range(mp) {
		fmt.Println(k, v)
	}
}

func calc(index string, a, b int) int {
	ret := a + b
	fmt.Println(index, a, b, ret)
	return ret
}

func main() {
	fmt.Println("沧浪之水")

	test1()

	amount := strconv.FormatFloat(float64(11.2255), 'f', 2, 32)
	fmt.Println(amount)

	//
	a := 1
	b := 2
	defer calc("1", a, calc("10", a, b))
	fmt.Println("_______defer__", a,b)
	a = 0
	defer calc("2", a, calc("20", a, b))
	b = 1

	roomList := []int{}
	roomList = append(roomList, 1)
	roomList = append(roomList, 2)
	roomList = append(roomList, 3)
	roomList = append(roomList, 1)
	roomList = append(roomList, 2)
	roomList = append(roomList, 3)
	//roomList = append(roomList[:0], roomList[1:]...) //删除第一个切片
	roomList = roomList[1:]

	fmt.Printf("roomList %v %v\n", roomList, cap(roomList))

}